﻿using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using WCSY.BLL;
using WCSY.MODEL;
using System.Data.SqlClient;
using System.Data;

public partial class UserManagement_UserClear : System.Web.UI.Page
{
    Mg_userManager userM = new Mg_userManager();
    protected void Page_Load(object sender, EventArgs e)
    {

        if (!IsPostBack)
        {
         
         DataTable userList = userM.GetList(" status =1 ").Tables[0];
         userListBind(userList);
        }
    }

    private void userListBind(DataTable userlist)
    {
        this.UserListGridView.DataSource = userlist;
        //Mg_userManager.GetAllMg_users();
        this.UserListGridView.DataBind();
    }



    protected void userclear_Click(object sender, EventArgs e)
    {
        //遍历每一行
        foreach (GridViewRow row in this.UserListGridView.Rows)
        {   //如果他是数据行
            if (row.RowType == DataControlRowType.DataRow)
            {
                //检测复选框是否选中
                CheckBox cb = row.FindControl("userSecCheckBox") as CheckBox;
                //判断是否选中没有
                if (cb.Checked)
                {

                    string id = this.UserListGridView.DataKeys[row.RowIndex]["userId"].ToString();
                    userM.ModifyMg_userStatus(id, "0");
                    


                    }
                }
            }
        Response.Write("<script>window.location = 'UserClear.aspx';</script>");
        }
    }
